package com.bifang.core.dao.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * @author chenzh
 * @since 2020-09-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("QRTZ_TRIGGERS")
@ApiModel(value = "QrtzTriggers对象", description = "")
public class QrtzTriggers extends Model<QrtzTriggers> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "调度名称")
    @TableId(value = "SCHED_NAME", type = IdType.INPUT)
    private String schedName;

    @ApiModelProperty(value = "触发器的名字")
    @TableField("TRIGGER_NAME")
    private String triggerName;

    @ApiModelProperty(value = "触发器所属组的名字")
    @TableField("TRIGGER_GROUP")
    private String triggerGroup;

    @ApiModelProperty(value = "任务名字")
    @TableField("JOB_NAME")
    private String jobName;

    @ApiModelProperty(value = "任务所属组名字")
    @TableField("JOB_GROUP")
    private String jobGroup;

    @ApiModelProperty(value = "触发器描述")
    @TableField("DESCRIPTION")
    private String description;

    @ApiModelProperty(value = "上一次触发时间（毫秒）")
    @TableField("NEXT_FIRE_TIME")
    private Long nextFireTime;

    @ApiModelProperty(value = "下一次触发时间，默认为-1，意味不会自动触发")
    @TableField("PREV_FIRE_TIME")
    private Long prevFireTime;

    @ApiModelProperty(value = "优先级")
    @TableField("PRIORITY")
    private Long priority;

    @ApiModelProperty(
            value =
                    "当前触发器状态，设置为ACQUIRED,如果设置为WAITING,则job不会触发 （ WAITING:等待 PAUSED:暂停ACQUIRED:正常执行 BLOCKED：阻塞 ERROR：错误）")
    @TableField("TRIGGER_STATE")
    private String triggerState;

    @ApiModelProperty(value = "触发器的类型，使用cron表达式")
    @TableField("TRIGGER_TYPE")
    private String triggerType;

    @ApiModelProperty(value = "开始时间")
    @TableField("START_TIME")
    private Long startTime;

    @ApiModelProperty(value = "结束时间")
    @TableField("END_TIME")
    private Long endTime;

    @ApiModelProperty(value = "日程表名称，表qrtz_calendars的calendar_name字段外键")
    @TableField("CALENDAR_NAME")
    private String calendarName;

    @ApiModelProperty(value = "措施或者是补偿执行的策略")
    @TableField("MISFIRE_INSTR")
    private Integer misfireInstr;

    @ApiModelProperty(value = "存放持久化job对象")
    @TableField("JOB_DATA")
    private byte[] jobData;

    @Override
    public Serializable pkVal() {
        return this.schedName;
    }
}
